import logging

# 配置参数
executorParams = {
    # 小区名称及爬取数量
    "section": {
        "恒大首府": 3000,
        "百川学府": 3000,
        "鹏程学府": 3000,
        "文华家园": 3000,
        "清水河畔": 3000,
        "寿春华府": 3000,
        "淠绿新村": 3000,
        "南河别墅": 3000,
        "碧水云天": 3000,
        "红达昆仑印": 3000,
        "万鑫御园": 3000,
        "众安玖珑府": 3000,
        "永安南苑": 3000,
        "正东凯旋名门": 3000,
        "正东凯旋观邸": 3000,
        "金马小区": 3000,
    },
    # 账号及爬取数量
    "user": {
        # "17356449637": 200,     -- 账号或密码错误
        # "18175485713": 200,     -- 账号或密码错误
        "18555866209": 200,
        "15855255368": 200,    # 无权查看
        "15212801152": 200,    # 无权查看
        "18788828938": 200,    # 无权查看
    },
    # 是否是测试用，如果是就不查房东信息
    "isTest": False,
    # 过滤跟进记录里的关键字
    "filter": [
        "卖掉了", "不卖了", "空号", "下架", "停机", "只租"
    ],
    # 每次停顿多少秒
    "sleep": True,
    "flowerText": ["房子还在卖的！", "电话暂时无人接听", "不卖了不卖了不卖了", "秒挂电话，不愿意聊",  "在卖 价格板扎的很", "没人接电话的", "看房提前电话联系", "房子在卖，价格可谈，房东也好讲话", "放子在卖，但是价格谈不了，板扎的很" "已经卖掉了 让下架掉!", "房东诚心卖，多推荐！",  "了解一下房子情况。可在卖了",  "问一下怎么看房！有客户"]
}

# 田秀峰 15056403020  403020
# 丁杨   15855255368  713520
# 王尚德 18175485713  666666
# 梅国强 18856423468  423468
# 邵三洋 18555866209  518518
# 汪海洋 15212801152  900607
# 陶传海 17356449637  861208
# 岳桂杰 18788828938  521112
users = [
    ["15056403020", "403020", "f8-20-a9-c1-18-6b"],
    ["15855255368", "713520", "f8-20-a9-c1-18-6b"],
    ["18175485713", "Ww123456 ", "f8-20-a9-c1-18-6b"],
    ["18856423468", "423468", "f8-20-a9-c1-18-6b"],
    ["18555866209", "518518", "f8-20-a9-c1-18-6b"],
    ["15212801152", "900607", "f8-20-a9-c1-18-6b"],
    ["17356449637", "861208", "f8-20-a9-c1-18-6b"],
    ["18788828938", "521112", "f8-20-a9-c1-18-6b"],
]
headersJson = {
    "accept": "application/json, text/javascript, */*; q=0.01",
    "request-from": "1",
    "Origin": "https://erp.fangline.cn",
    "x-requested-with": "XMLHttpRequest",
    "page-name": "/visit-house/house-list",
    "user-agent": "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.108 Safari/537.36",
    "cookie": "SERVERID=9d68c5451939286014101f3f74e005c5|1711548621|1711547970;Path=/; JSESSIONID=c95f95b8-4abd-4f29-a820-7c825fc621e0; SERVERID=9d68c5451939286014101f3f74e005c5|1711548621|1711547970; guideStatus=6",
    "Postman-Token": "afaed83c-76b0-4db1-a6d6-cb290087d83f",
    "Host": "erp.fangline.cn",
    "Accept-Encoding": "gzip, deflate, br",
    "Connection": "keep-alive",
    "Content-Length": "0",
    "Content-Type": "application/json",
}


def setup_logging(log_file):
    # 配置日志记录
    logging.basicConfig(level=logging.INFO,
                        format='%(asctime)s - %(levelname)s - %(message)s')

    # 创建一个文件处理器
    file_handler = logging.FileHandler(log_file, mode='a', encoding='utf-8')
    file_handler.setFormatter(logging.Formatter(
        '%(asctime)s - %(levelname)s - %(message)s'))
    logging.getLogger().addHandler(file_handler)

    # 创建一个控制台处理器
    console_handler = logging.StreamHandler()
    console_handler.setFormatter(logging.Formatter(
        '%(asctime)s - %(levelname)s - %(message)s'))
    logging.getLogger().addHandler(console_handler)


house_search_json = {
    "pc": "true",
    "batch": "true",
    "houseTypeRanges": [],
    "bizType": "sell",
    "status": "有效",
    "houseRangeUserType": 1,
    "houseRangeType": "按管理权限",
    "houseRangeAuth": 127,
    "houseRangeUser": "",
    "houseRangeDeptList": "",
    "pcTagRanges": [],
    "pcTagIntersection": "false",
    "trustType": "",
    "rentType": "",
    "checkInTime": "",
    "positionIn": [],
    "schoolIdList": [],
    "schoolIntersection": "false",
    "searchType": "",
    "searchStr": "",
    "roomRanges": [],
    "areaBegin": "",
    "areaEnd": "",
    "totalPriceBegin": "",
    "totalPriceEnd": "",
    "priceUnit": "",
    "unitPriceBegin": "",
    "unitPriceEnd": "",
    "blockNo": "",
    "unitNo": "",
    "cell": "",
    "exactBlockSearch": "false",
    "floorBegin": "",
    "floorEnd": "",
    "areaRangeList": [],
    "floorList": [],
    "towardsRanges": [],
    "decorationRanges": [],
    "houseAgeRanges": [],
    "houseSubTypeRanges": [],
    "openTypeRanges": [],
    "levelRanges": [],
    "coverAreaRangeList": [],
    "gardenAreaRangeList": [],
    "hallStructRanges": [],
    "basementTypeRanges": [],
    "totalFloorRanges": [],
    "manageLevelRanges": [],
    "suitBizRanges": [],
    "fitmentRanges": [],
    "propertyCertRanges": [],
    "paymodeRanges": [],
    "minRentTermRanges": [],
    "orderBy": 0,
    "current": 1,
    "size": 40
}